from flask import Flask
from settings import map_config


# 负责创建app
def create_app(config_type: str) -> Flask:
    app = Flask(__name__)
    # 加载项目配置
    app.config.from_object(map_config.get(config_type))
    # 加载日志处理工具

    # 初始化ORM
    from comment.moudles import db
    db.init_app(app=app)

    # 加载模块蓝图
    from Shoping.resources.user import user_bp
    # ==================加载 user 模块蓝图 =================
    app.register_blueprint(user_bp)
    return app
